< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03120303.xhp

(section: left) (bookmark: bm_id3149346)
Left function

Left 関数

Left Function [Runtime]
Left 関数 [実行時](hd_id3149346.1)

Returns the number of leftmost characters that you specify of a string expression.
与えられた文字列表式の左側から、指定分の文字を取得して返します。(par_id3147242.2)

(/section: left)

Syntax:
構文:(hd_id3156153.3)

Left (Text As String, n As Long)
Left (Text As String, n As Integer)(par_id3150771.4)

Return value:
戻り値:(hd_id3153824.5)

String
文字列(par_id3147530.6)

Parameters:
パラメータ:(hd_id3148946.7)

Text: Any string expression that you want to return the leftmost characters from.
Text: 左側の文字を取得する文字列表式。(par_id3148552.8)

n: Numeric expression that specifies the number of characters that you want to return. If n = 0, a zero-length string is returned. The maximum allowed value is 65535.
n: 取得する文字の数を指定する整数表式。n にゼロを指定すると、文字長ゼロの空白文字列が返されます。(par_id3149456.9)

The following example converts a date in YYYY.MM.DD format to MM/DD/YYYY format.
下記の例では、YYYY.MM.DD 形式の日付を MM/DD/YYYY 形式に変換しています。(par_id3150791.10)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

Example:
例:(hd_id3125863.11)

Sub ExampleUSDate
Sub ExampleUSDate(par_id3144761.12)

Dim sInput As String
Dim sInput As String(par_id3153194.13)

Dim sUS_date As String
Dim sUS_date As String(par_id3154217.14)

sInput = InputBox("Please input a date in the international format 'YYYY-MM-DD'")
sInput = InputBox("Please input a date in the international format 'YYYY-MM-DD'")(par_id3150448.15)

sUS_date = Mid(sInput, 6, 2)
sUS_date = Mid(sInput, 6, 2)(par_id3149203.16)

sUS_date = sUS_date & "/"
sUS_date = sUS_date & "/"(par_id3150439.17)

sUS_date = sUS_date & Right(sInput, 2)
sUS_date = sUS_date & Right(sInput, 2)(par_id3153770.18)

sUS_date = sUS_date & "/"
sUS_date = sUS_date & "/"(par_id3161833.19)

sUS_date = sUS_date & Left(sInput, 4)
sUS_date = sUS_date & Left(sInput, 4)(par_id3147215.20)

MsgBox sUS_date
MsgBox sUS_date(par_id3149666.21)

End Sub
End Sub(par_id3153138.22)


< Prev / Next >